<%@ page contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="p" tagdir="/WEB-INF/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<head>
<meta charset="UTF-8">
 <title>文件上传</title>
    <link rel="stylesheet" href="${ctx}/comp/plupload/queue/css/jquery.plupload.queue.css" type="text/css"></link>
  <script type="text/javascript" src="${ctx}/comp/plupload/jquery-1.8.3.min.js"></script> 
	<script type="text/javascript" src="${ctx}/comp/plupload/plupload.js"></script>
	<script type="text/javascript" src="${ctx}/comp/plupload/plupload.html4.js"></script>
	<script type="text/javascript" src="${ctx}/comp/plupload/plupload.html5.js"></script>
	<script type="text/javascript" src="${ctx}/comp/plupload/plupload.flash.js"></script>
	<script type="text/javascript" src="${ctx}/comp/plupload/zh_CN.js"></script>
    <script type="text/javascript" src="${ctx}/comp/plupload/queue/jquery.plupload.queue.js"></script>

</head>

<body style="padding: 0;margin: 0;">
	<div class="easyui-dialog" style="width: 50%;height: 50%;" title="上传附件">
	    	<div id="uploader" ></div>
	    	<script type="text/javascript">
			var files = [];
			var errors = [];
			var type = 'file';
			var chunk = eval('${param.chunk}');
			var max_file_size = '5mb';
			var filters = {title : "图标", extensions : "jpg,gif,ico,png,jpeg,bmp,apk,doc,zip,war"};
			$("#uploader").pluploadQueue($.extend({
				runtimes : 'flash,html4,html5',
				url : '${ctx}/BscDicCode/uploadAttach',
				max_file_size : max_file_size,
				file_data_name:'attach',
				unique_names:true,
				filters : [filters],
				flash_swf_url : '${ctx}/comp/plupload/plupload.flash.swf',
				init:{
					FileUploaded:function(uploader,file,response){
						if(response.response){
							var rs = $.parseJSON(response.response);
							if(rs.status){
								files.push(file.name);
							}else{
								errors.push(file.name);
							}
						}
					},
					UploadComplete:function(uploader,fs){
						/* var e= errors.length ? ",失败"+errors.length+"个("+errors.join("、")+")。" : "。";
						alert("上传完成！共"+fs.length+"个。成功"+files.length+e);
						target.window("close"); */
						
					}
				}
			},(chunk ? {chunk_size:'1mb'} : {})));
			</script>
		</div>
</body>

	